In daily use, an electronic apparatus, such as a cell phone or a tablet, may often use related accessories (including attachments), for example, for charging by connecting to a charger, data transmission by connecting to a data cable, and listening by connecting to earphones.
When an electronic apparatus is connected to and uses an accessory, it is possible to damage the electronic apparatus, or even cause severe accidents like personal injuries, if the accessory has an inferior quality. In addition, there are more and more illegitimate manufacturers using inferior materials or lax processes to produce accessories, making it difficult to ensure the quality of accessories. If faulty accessories produced by these illegitimate manufacturers are used, it may be even easier to damage electronic apparatuses or cause severe casualty accidents. Reports have shown that death caused by electrical creepage, or damage to electronic apparatuses, burning and other incidents occur from time to time due to the use of faulty chargers in charging, which have resulted in significant risk and safety hazard for users of electronic apparatuses.
Before an accessory is used by an electronic apparatus, the accessory may be certified first so as to determine if the accessory is a legitimate accessory. When the accessory passes the certification, the electronic apparatus may use the functions of the accessory. If the accessory fails the certification, the electronic apparatus may not be connected to the accessory for its functions, and therefore will not use the accessory, thereby ensuring that legitimate accessories can be used by electronic apparatuses. In the existing methods for accessory certification, asymmetric encryption algorithms are often used for accessory certification. Two keys may be required in an asymmetric encryption algorithm, a public key and a private key. When the public key is used for encryption, decryption can only be performed with the matching private key. When the private key is used for encryption, decryption can only be performed with the matching public key. The public key is public, while the private key is only known to the decrypting party.
The public key and the private key may be stored directly in a secure part of a memory, i.e. the public key and the private key may not be processed. When the public key and the private key are used for encryption and decryption, they just need to be directly retrieved from the memory. Such a storage manner lowers the security level of the public key and the private key, and it may be easy for hackers to break the keys. In particular, if the public key is broken by hackers, it is possible to result in errors in the entire accessory certification and to certify illegitimate accessories as legitimate accessories.